<?php

class m111023_085331_account_token_project extends CDbMigration {
	public function safeUp() {
		$this->addColumn('erp_account_token', 'projectId', 'int');
		$this->createIndex("account_token_project_id", 'erp_account_token', 'projectId');
		$this
			->addForeignKey('fk_account_token_project_id', 'erp_account_token', 'projectId',
				'erp_project', 'id', 'SET NULL', 'CASCADE');

	}

	public function safeDown() {
		$this->dropForeignKey('fk_account_token_project_id', 'erp_account_token');
		$this->dropIndex("account_token_project_id", 'erp_account_token');
		$this->dropColumn('erp_account_token', 'projectId');
	}
}
